/*
 * Copyright (c) 2014. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package com.jspx.txweb.vo;

import com.jspx.sober.annotation.Column;
import com.jspx.sober.annotation.Table;
import com.jspx.utils.StringUtil;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenyuan on 14-3-14.
 * 统计证书的合格比例
 */
@Table(name = "jspx_position_cert_vo", caption = "证书比例视图",create = false)
public class PositionCertVO implements Serializable {
    public PositionCertVO()
    {

    }

    @Column(caption = "组织机构ID", notNull = true)
    private long organizeId;

    @Column(caption = "组织机构", length = 20)
    private String organize = StringUtil.empty;

    @Column(caption = "岗位", dataType="isLengthBetween(0,200)",length = 200)
    private List<PositionStatVO> list = new ArrayList<PositionStatVO>();

    public long getOrganizeId() {
        return organizeId;
    }

    public void setOrganizeId(long organizeId) {
        this.organizeId = organizeId;
    }

    public String getOrganize() {
        return organize;
    }

    public void setOrganize(String organize) {
        this.organize = organize;
    }

    public List<PositionStatVO> getList() {
        return list;
    }

    public void setList(List<PositionStatVO> list) {
        this.list = list;
    }

    public void putPositionStat(PositionStatVO positionNum) {
        this.list.add(positionNum);
    }

    public boolean containsPosition(String position) {
        for (PositionStatVO positionNum: this.list)
        {
            if (positionNum.getPosition().equals(position)) return true;
        }
        return false;
    }

    public PositionStatVO createPositionStat()
    {
        return new PositionStatVO();
    }
}